import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/index'
import './plugins/element.js'

import axios from 'axios'

// 背景特效插件
import VueParticles from 'vue-particles'

// import $ from 'jquery'
// 引入bootstrap4 参考文档：
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'
import 'jquery'

// 导入字体图标样式
import './assets/fonts/iconfont.css'
// 导入全局样式表
import './assets/css/global.css'

// 引入Echarts 参考文档：https://echarts.apache.org/zh/tutorial.html#5%20%E5%88%86%E9%92%9F%E4%B8%8A%E6%89%8B%20ECharts
import Echarts from 'echarts'
// 引入mavon-editor 参考文档：https://www.jianshu.com/p/78ea4f94a3d0
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

// 页面无限滚动
import infiniteScroll from 'vue-infinite-scroll'

// 日期格式化 --在需要转换日期格式的vue页面中{{time|moment}}
import moment from 'moment/moment'

// import Blob from './vendor/Blob'
// import Export2Excel from './vendor/Export2Excel'

Vue.use(infiniteScroll)
Vue.filter('moment', function (value, formatString) {
    formatString = formatString || 'YYYY-MM-DD'
    return moment(value).format(formatString)
})

Vue.prototype.echarts = Echarts
Vue.use(Echarts)
Vue.use(mavonEditor)
Vue.use(VueParticles)

// 配置请求的根路径
// axios.defaults.baseURL = 'http://120.25.169.204:8080'
axios.defaults.baseURL = 'http://119.23.46.76:8080'

// 请求拦截
axios.interceptors.request.use(config => {
    const token = localStorage.getItem('token')
    if (token) {
        config.headers.token = token
    }
    return config
    // // 为请求头对象，添加Token验证的xxx字段
    // config.headers.token = window.sessionStorage.getItem('token')
    // return config
})
Vue.prototype.$http = axios
// 参考后端api文档：http://rap2.taobao.org/repository/editor?id=256652  账号：121256478@qq.com，密码：121256478a

Vue.config.productionTip = false
new Vue({
    store,
    router,
    render: h => h(App)
}).$mount('#app')
